<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Answer extends Model
{
    protected $table = 'answer';
        public $timestamps = false;

        /**
         * 查找回答的用户名
         */
        public function getUser()
        {
        	return $this->belongsTo('App\User','user_id');
        }

        /**
         * 找到该问题的点赞数
         */
        public function getPraise()
        {
        	return $this->hasMany('App\Apraise','answer_id');
        }


        /**
         * 查找该回答的评论
         */
        public function getComments()
        {
        	return $this->hasMany('App\Comments','answer_id');
        }

    /**
     * 查找该回答的评论
     */
    public function getComments()
    {
    	return $this->hasMany('App\Comments','answer_id');
    }

    /**
     * 拿到用户的头像
     */
    public function getUserPortrait()
    {
        return $this->belongsTo('App\Detail', 'user_id');
    }
   
}
